class ResModel {

  constructor(code, message, result) {
    this.code = code;
    this.message = message;
    if (result) this.result = result;
  }

  static success(result) {
    return new ResModel(200, 'success', result);
  }

  static error(model) {
    return new ResModel(model.code, model.message);
  }

  static message(code, message, result) {
    return new ResModel(code, message, result);
  }

}

module.exports = ResModel;
